/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.general.be.TipoUsuario;
import org.cip.esymons.general.be.UserExtMenu;

/**
 *
 * @author ADMINISTRADOR
 */
public class UserExtMenuDelegate {

    private UserExtMenuFacadeLocal local;

    public UserExtMenuDelegate() {

        local = lookupUserExtMenuFacadeLocal();
    }

    public void create(UserExtMenu userExtMenu){

        local.create(userExtMenu);
    }

    public void edit(UserExtMenu userExtMenu){

        local.edit(userExtMenu);
    }

    public void remove(UserExtMenu userExtMenu){

        local.remove(userExtMenu);
    }

    public UserExtMenu find(Object id){

        return local.find(id);
    }

    public List<UserExtMenu> findAll(){

        return local.findAll();
    }

    public List<UserExtMenu> menuPorUsuario(TipoUsuario tipo){

        return local.menuPorUsuario(tipo);
    }

    public List<UserExtMenu> menuPorUsuarioPorTipo(Integer tipo){

        return local.menuPorUsuarioPorTipo(tipo);
    }

    public List<UserExtMenu> menuPorUsuarioPorTipoUser(String tipo){

        return local.menuPorUsuarioPorTipoUser(tipo);
    }


    private UserExtMenuFacadeLocal lookupUserExtMenuFacadeLocal() {
        try {
            Context c = new InitialContext();
            return (UserExtMenuFacadeLocal) c.lookup("java:comp/env/UserExtMenuFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
